<form action="<?= lang_url('search') ?>" method="GET" id="search_form" class='form_<?= $this->lang->mci_current() ?>'>

    <fieldset>

        <div class="legend">
            <?= $text ?> 
            <?php
                $acctype = isset($_GET['acc_type']) ? $_GET['acc_type'] : 'empty';
                switch ($acctype) {
                    case 'appartment':
                        $frmtitle = strtolower(lang('form.private'));
                        break;
                    case 'hotel':
                        $frmtitle = strtolower(lang('nav.hotels'));
                        break;
                    case 'authentic accommodation':
                        $frmtitle = strtolower(lang('form.authentic'));
                        break;
                    case 'youth hostel':
                        $frmtitle = strtolower(lang('nav.youth'));
                        break;
                    case 'houses with pool':
                        $frmtitle = strtolower(lang('form.house_pools'));
                        break;
                    case ('empty' && $this->router->fetch_method() != 'index'):
                        $frmtitle = strtolower(lang('form.private'));
                        break;
                    default: $frmtitle = "";
                }

                echo $frmtitle;
            ?>
        </div>

        <?php
            if (isset($_GET['acc_type'])) {
                ?>

                <input type="hidden" value="<?= $_GET['acc_type'] ?>" name="acc_type">

                <?php
            } else {
                ?>

                <div class="control-group clearfix vertical2 what">

                    <label class="control-label home_control_label"><?= lang('form.what'); ?>?</label>

                    <div class="controls ">    

                        <div class="clearfix">

                            <div class="pull-left"> 

                                <input type="radio" checked="checked" value="appartment" name="acc_type" >
                                <span><?= lang('form.private'); ?></span>
                                <br>
                                <input type="radio" value="authentic accommodation" name="acc_type" >
                                <span><?= lang('form.authentic'); ?></span>

                            </div>

                            <div class="pull-left"> 

                                <input type="radio" value="hotel" name="acc_type" >
                                <span><?= lang('nav.hotels'); ?></span>
                                <br>
                                <input type="radio" value="youth hostel" name="acc_type" >
                                <span><?= lang('nav.hostels'); ?></span>

                            </div>
                        </div>

                        <div class="">
                            <input type="radio" value="houses with pool" name="acc_type" >
                            <span><?= lang('form.house_pools'); ?></span>
                        </div>


                    </div>



                </div><!-- / accommodation type-->

            <?php } ?>

        <div class="control-group clearfix where">

            <label class="control-label home_control_label"><?= lang('form.where'); ?>?</label>

            <div class="controls clearfix">    

                <?php
                    $dest_hot = lang('form.dest_region');

                    if (isset($_GET['dest_hot']) && ($_GET['dest_hot'] != -1 ) && ($_GET['dest_hot'] != "" ))
                        $dest_hot = $_GET['dest_hot'];
                ?>

                <input type="text" class="" value="<?= $dest_hot ?>" name="dest_hot" id="dest_hot">
            </div>

        </div> <!-- / destinations-->

        <div class="control-group clearfix vertical2 when_cor">

            <label class="control-label home_control_label"><?= lang('form.when'); ?>?</label>

            <div class="controls clearfix">

                <?php
                    $check_in = date('d.m.Y', strtotime("+0 day"));

                    if (isset($_GET['check_in']))
                        $check_in = $_GET['check_in'];

                    $check_out = date('d.m.Y', strtotime("+1 day"));

                    if (isset($_GET['check_out']))
                        $check_out = $_GET['check_out'];
                ?>

                <div class="pull-left">    

                    <input type="text" value="<?= $check_in ?>" name="check_in" id="check_in" class="checkinout">

                </div>

                <div class="pull-left">  

                    <input type="text" value="<?= $check_out ?>" name="check_out" id="check_out" class="checkinout">

                </div>

            </div>

        </div><!-- / dates-->

        <div class="control-group clearfix vertical2 persons personaccomm">

            <label class="control-label home_control_label label_person_<?= $this->lang->mci_current() ?>"><?= lang('form.persons_title'); ?>?</label>

            <div class="controls clearfix">   

                <select name="nr_adults" id="nr_adults" class="input-small pull-left">

                    <?php
                        $sel_text = 'selected = "selected"';

                        if (isset($_GET['nr_adults'])) {
                            $selected = $_GET['nr_adults'];
                            $cnt = (isset($_GET['acc_type']) && $_GET['acc_type'] == 'hotel') ? 5 : 12;
                        } else if (isset($_GET['acc_type']) && $_GET['acc_type'] == 'hotel') {
                            $selected = 2;
                            $cnt = 5;
                        } else {
                            $selected = 2;
                            $cnt = 12;
                        }


                        for ($index = 1; $index <= $cnt; $index++):
                            ?>

                            <option value = "<?= $index ?>" <? if ($selected == $index) echo $sel_text; ?>><?= $index ?> <?= $index == 1 ? lang('form.person') : ($index > 4 && $this->lang->mci_current() == 'me') ? lang('form.person') : lang('form.persons'); ?></option>

                        <?php endfor; ?>

                </select><br>
                <span class = "help-block pull-left">(<?= lang('form.excl'); ?> 0-2)</span>

            </div>

        </div><!--/ personaccomm-->

        <div class = "form-actions">

            <?php if (isset($_GET['currency'])): ?>
                    <input type="hidden" value="<?= $_GET['currency'] ?>" name="currency">
                <?php endif; ?>

            <button class = "button-home" type = "submit" id = "submit"><span><?= lang('form.search'); ?></span></button>
        </div><!--/ actions-->

    </fieldset>

</form>